package com.aat.dxfy.weixinAuto;

import com.alibaba.fastjson.JSONObject;


public class Tuling {

	public static void main(String[] args) {
		String[] ss={"你好","你叫什么名字","你多大了","你住在哪呢","嗯","哦","我擦","你是逗比吗","我去吃饭了","给我唱一首歌呗"};
		for (String s : ss) {
			System.out.println("猴子："+s);
			testTL(s);
			testXDB(s);
			System.out.println();
		}
	}

	public static void testTL(String msg) {
		JSONObject json = new JSONObject();
		json.put("key", "dc45f5ddaeb44cc49f4f59384ff8ceab");
		json.put("info", msg);
		json.put("loc", "北京海淀");
		json.put("userid", "123");
		String res = HttpRequest.sendPost("http://www.tuling123.com/openapi/api", json.toJSONString());
		String key = "text";
		int i = res.indexOf(key);
		res = res.substring(i + key.length() + 3, res.length() - 2);
		System.out.println("图灵："+res);
	}

	public static void testXDB(String msg) {
		String url = "http://i.itpk.cn/api.php?api_key=4c60a4ab6c15c7e60c40a6affdf27173&api_secret=or1zd5ale2ap&limit=7&question="
				+ msg;
		String res = blade.kit.http.HttpRequest.get(url).body();
		System.out.println("逗比："+res);
	}

}
